$(function () {
   $('#regist-btn').click(function (event) {
       event.preventDefault();
       var nameInput = $('input[name="name"]');
       var telephoneInput = $('input[name="telephone"]');
       var emailInput = $('input[name="email"]');
       var passwordInput = $('input[name="password"]');
       var repasswordInput = $('input[name="repassword"]');

       var name = nameInput.val();
       var telephone = telephoneInput.val();
       var email = emailInput.val();
       var password = passwordInput.val();
       var repassword = repasswordInput.val();

       if(!name || !telephone || !email || !password || !repassword){
           xtalert.alertInfoToast('请输入完整信息！')
       }else{
           zlajax.post({
               'url': /regist/,
               'data': {
                   'name': name,
                   'telephone': telephone,
                   'email': email,
                   'password': password,
                   'repassword': repassword
               },
               'success': function (data) {
                   if (data['code'] == 200) {
                       xtalert.alertSuccessToast('注册成功！');
                       window.location = 'index'
                   } else {
                       xtalert.alertInfo(data['message'])
                   }
               }
           })
       }
   })
});